"""
金叉：2，死叉：-2  向上：1  向下：-1
支持重复计算，但是要指定timekey，只能向前重复计算
"""
from copy import deepcopy
from research.calcor import calcor_base
class delaydata_bar(calcor_base):
    def __init__(self,args=[],delay=1):
        super().__init__(timeperiod=delay+1,datatype="bar")
        self.args=args
    def calc(self):
        b=self.hisdata[0]
        rst=[]
        for k in self.args:
            rst.append(b[k])
        return rst
class delaydata(calcor_base):
    def __init__(self, args=[], delay=1):
        super().__init__(timeperiod=delay + 1, datatype="dimn1")
        self.args = args

    def calc(self):
        b = self.hisdata[0]
        return b
